using System.Linq;
using UnityEngine.UIElements;

namespace DA.AnimGraph.Editor {
    public class FoldoutPro : Foldout {

        VisualElement titleContainer;
        VisualElement shoulderContainer;

        public FoldoutPro() {
            titleContainer = new() {
                style = {
                    flexDirection = FlexDirection.Row,
                    flexGrow = 1,
                }
            };
            shoulderContainer = new() {
                style = {
                    flexDirection = FlexDirection.Row
                }
            };
            Toggle toggle = this.Q<Toggle>();
            toggle.Children().ToArray()[0].style.flexGrow = 0;
            toggle.contentContainer.Add(titleContainer);
            toggle.contentContainer.Add(shoulderContainer);
        }
        public void AddToShoulder(VisualElement ele) {
            if (ele == null) return;
            shoulderContainer.Add(ele);
        }
        public void SetToTitle(VisualElement ele) {
            titleContainer.Clear();
            if (ele == null) return;
            titleContainer.Add(ele);
        }

    }
}
